package cn.kgc.springcloud.controller;

import cn.kgc.springcloud.entity.Group;
import cn.kgc.springcloud.service.GroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/groups")
public class GroupController {
    @Autowired
    private GroupService groupService;
    //查询小组列表
    @GetMapping
    public List<Group> queryAll(){
        return groupService.queryAll();
    }

    //添加小组信息
    @PostMapping
    public Group addOne(@RequestBody Group group){
        return groupService.addOne(group);
    }

    @GetMapping("/{id}")
    public Group selectOne(@PathVariable Integer id){
        return groupService.selectOne(id);
    }
}
